#ifndef _PS_TASK_H_
#define _PS_TASK_H_

#include <stdint.h>

#include <glib.h>

#include "pseudo.h"

struct _ps_task_s
{
    PSTHREAD	callback;
  	void        *anything;
    ps_task_t   *head;
    ps_task_t   *next;
    ps_task_t   *prev;
    int16_t     priority;
    uint8_t     flags;
};

#define PS_TASK(x)   ((ps_task_t*)x)

ps_task_t*  ps_task_create(PSTHREAD callback,void *anything);

ps_task_t*  ps_task_fetch(ps_task_t *task_list,int16_t offset);

void		ps_task_swap(ps_task_t *node1,ps_task_t *node2);

void		ps_task_append(ps_task_t *task_list,ps_task_t *node);

void		ps_task_prepend(ps_task_t *task_list,ps_task_t *node);

void        ps_task_shift_down(ps_task_t *task);

void        ps_task_shift_up(ps_task_t *task);

ps_task_t*	ps_task_unlink(ps_task_t *task);

ps_task_t*	ps_task_destroy(ps_task_t *task);

#endif
